let users = {
    '001': {
        roles: ['admin']
    },
    '002': {
        roles: ['member']
    }
}

function authorize(target,propertyKey,descriptor){
    const originalMethod = descriptor.value
    descriptor.value = function (...args){
       let user = users[args[0]]
       if (user && user.roles.includes('admin')) {
        originalMethod.apply(this, args)
       } else {
        
        throw new Error('用户没权限')
       }
    }
    return descriptor
}

class AdminPanel{
    @authorize
    deleteUser(userId){
        console.log('删除成功UserId：', userId)
    }
}
const adminPanel = new AdminPanel()
console.log('ddd', adminPanel.deleteUser('001'))